#include"Udp_server.hpp"
#include"Dictionary.hpp"

int main(int argc, char* argv[])
{
    if(argc!= 2){
        std::cout<<"Usage: "<<argv[0]<<"[port]"<<std::endl;
        DIE(1);
    }
    uint16_t port = std::stoi(argv[1]);
    ENABLE_CONSOLE_LOG();
    std::shared_ptr<Dict> dict = std::make_shared<Dict>();
    std::unique_ptr<Udp_server> server = std::make_unique<Udp_server>( [&dict](const std::string &word){
        return dict->Translate(word);
    }, port);
    server->Init();
    server->Start();
    return 0;
}